<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use \think\facade\Route;

Route::group('adminapi/v3',  function () {
//*******************************************安装 START****************************************************
    Route::group('install',  function () {
        Route::rule('online', 'adminapiv3/Install/online');//在线授权
        Route::rule('offline', 'adminapiv3/Install/offline');//离线授权
        Route::rule('download', 'adminapiv3/Install/downloadHostFile');//下载主机码文件
        Route::rule('userconfig', 'adminapiv3/Install/userConfig');//设置系统管理员
        Route::rule('addproxyip', 'adminapiv3/Install/addProxyIp');//设置代理服务器IP
        Route::rule('getmodule', 'adminapiv3/Install/getModule');//获取模块信息
    });
//*******************************************安装 END****************************************************

    Route::rule('isInstall', 'adminapiv3/Index/isInstall');//是否安装
    Route::rule('index', 'adminapiv3/Index/index');//首页
    Route::rule('menu', 'adminapiv3/Menu/index');//菜单
    Route::rule('login', 'adminapiv3/Login/login');//登录
    Route::rule('code', 'adminapiv3/Login/code');//验证码
    Route::rule('platform/auth/info', 'adminapiv3/platform_manage.ServerAuth/platformAuthInfo');//平台授权信息(登录前)
    Route::rule('platform/auth/userGroupAuthInfo', 'adminapiv3/platform_manage.ServerAuth/userGroupAuthInfo');//资产组授权信息(登录后)

//****************************************资产管理 START****************************************

//1. 资产管理
    Route::group('host',  function () {
        Route::rule('list', 'adminapiv3/asset_manage.host.Host/list');//主机列表 所有主机 all 其他都是 模块名
        Route::rule('add', 'adminapiv3/asset_manage.host.Host/add');//主机添加
        Route::rule('checkClient', 'adminapiv3/asset_manage.host.Host/checkClient');//主机检测
        Route::rule(':host_id/port/list', 'adminapiv3/asset_manage.host.Host/portList');//主机开放端口
        Route::rule(':host_id/modify', 'adminapiv3/asset_manage.host.Host/modify');//主机修改
        Route::rule(':host_id/detail', 'adminapiv3/asset_manage.host.Host/detail');//主机详情
        Route::rule('delete', 'adminapiv3/asset_manage.host.Host/delete');//删除主机
        Route::rule('dataStatistics', 'adminapiv3/asset_manage.host.Host/dataStatistics');//统计 index/all
        Route::rule('filterData', 'adminapiv3/asset_manage.host.Host/filterData');//主机筛选数据
        Route::rule(':host_id/hardwareUsed', 'adminapiv3/asset_manage.host.Host/hardwareUsed');//主机硬件信息
        Route::rule('template', 'adminapiv3/asset_manage.host.Host/template');//模板下载
        Route::rule('bulkImport', 'adminapiv3/asset_manage.host.Host/bulkImport');//批量导入
        Route::rule('client/download', 'adminapiv3/asset_manage.host.Host/clientDownload');//客户端下载
        Route::rule('show/group', 'adminapiv3/asset_manage.host.Host/showGroup');//展示资产组信息
        Route::rule('binding/group', 'adminapiv3/asset_manage.host.Host/bindingGroup');//资产绑定资产组
        Route::rule('network', 'adminapiv3/asset_manage.host.Host/network');//主机网卡信息

    });

//2. 资产位置
    Route::group('address',  function () {
        Route::rule('list', 'adminapiv3/asset_manage.address.Address/list');//资产位置列表
        Route::rule('add', 'adminapiv3/asset_manage.address.Address/add');//资产位置添加
        Route::rule('modify', 'adminapiv3/asset_manage.address.Address/modify');//资产位置修改
        Route::rule('del', 'adminapiv3/asset_manage.address.Address/del');//资产位置删除
        //内网ip管理
        Route::group('intranet_ip',  function () {
            //内网ip列表
            Route::rule('list', 'adminapiv3/asset_manage.address.IntranetIp/list');
            //添加内网ip
            Route::rule('add', 'adminapiv3/asset_manage.address.IntranetIp/add');
            //修改内网ip
            Route::rule('modify', 'adminapiv3/asset_manage.address.IntranetIp/modify');
            //删除内网iP
            Route::rule('delete', 'adminapiv3/asset_manage.address.IntranetIp/delete');
        });
    });

//3. 组织架构->部门接口
    Route::group('ministry',  function () {
        Route::rule('add', 'adminapiv3/asset_manage.ministry.Ministry/add');//添加部门
        Route::rule('list', 'adminapiv3/asset_manage.ministry.Ministry/list');//部门列表
        Route::rule('del', 'adminapiv3/asset_manage.ministry.Ministry/del');//删除部门
        Route::rule('modify', 'adminapiv3/asset_manage.ministry.Ministry/modify');//修改部门
    });


//3. 组织架构->责任人接口
    Route::group('manager',  function () {
        Route::rule('add', 'adminapiv3/asset_manage.ministry.Manager/add');//添加责任人
        Route::rule('list', 'adminapiv3/asset_manage.ministry.Manager/list');//责任人列表
        Route::rule('del', 'adminapiv3/asset_manage.ministry.Manager/del');//删除责任人
        Route::rule('modify', 'adminapiv3/asset_manage.ministry.Manager/modify');//修改责任人
    });


//4. 业务系统管理
    Route::group('software',  function () {
        Route::rule('list', 'adminapiv3/asset_manage.software.Software/list');//业务系统列表
        Route::rule('add', 'adminapiv3/asset_manage.software.Software/add');//业务系统添加
        Route::rule('detail', 'adminapiv3/asset_manage.software.Software/detail');//业务系统详情
        Route::rule('modify', 'adminapiv3/asset_manage.software.Software/modify');//业务系统修改
        Route::rule('del', 'adminapiv3/asset_manage.software.Software/del');//业务系统删除
        Route::rule('retire', 'adminapiv3/asset_manage.software.Software/retire');//业务系统退役
    });


//5. 服务商管理
    Route::group('service',  function () {
        Route::rule('list', 'adminapiv3/asset_manage.service_provider.Service/list');//服务商列表
        Route::rule('add', 'adminapiv3/asset_manage.service_provider.Service/add');//服务商添加
        Route::rule('modify', 'adminapiv3/asset_manage.service_provider.Service/modify');//服务商修改
        Route::rule('del', 'adminapiv3/asset_manage.service_provider.Service/del');//服务商删除
        Route::rule('detail', 'adminapiv3/asset_manage.service_provider.Service/detail');//服务商详情
        Route::rule('updateservice', 'adminapiv3/asset_manage.service_provider.Service/updateService');//续约更新
        Route::rule('endcontract', 'adminapiv3/asset_manage.service_provider.Service/endContract');//合同中止
        Route::rule('servicehistory', 'adminapiv3/asset_manage.service_provider.Service/serviceHistory');//服务商历史
    });

//****************************************资产管理 END****************************************

    //模块管理
    Route::group('module',  function () {
        $route = 'adminapiv3/module_manage';
        include 'module/netfilter.php';
        include 'module/disguise.php';
        include 'module/hgshield.php';
    });
    

    /*********************************************************平台管理 START ******************************************************/

    //服务器配置
    Route::group('config',function (){
        //IP白名单 : 平台管理 -> 信任主机 -> 功能设置
        Route::group('ipWhiteSetting',function (){
            Route::rule('get', 'adminapiv3/platform_manage.Config/getIpWhiteSetting');//配置获取
            Route::rule('modify', 'adminapiv3/platform_manage.Config/modifyIpWhiteSetting');//配置写入
        });

        //syslog配置 : 平台管理 -> 同步配置 -> syslog配置
        Route::group('syslog',function (){
            Route::rule('get', 'adminapiv3/platform_manage.Config/getSyslogSetting');//配置获取
            Route::rule('modify', 'adminapiv3/platform_manage.Config/modifySyslogSetting');//配置写入
        });

        //平台设置 : 平台管理->平台设置
        Route::group('webPageAlertsManage',function (){
            Route::rule('get', 'adminapiv3/platform_manage.Config/getWebPageAlertsManage');//配置获取
            Route::rule('modify', 'adminapiv3/platform_manage.Config/modifyWebPageAlertsManage');//配置写入
        });

        //登录设置: 平台管理->用户管理->登录设置
        Route::group('login',function (){
            Route::rule('get', 'adminapiv3/platform_manage.Config/getLogin');//配置获取
            Route::rule('modify', 'adminapiv3/platform_manage.Config/modifyLogin');//配置写入
        });

        //服务器运行状态
        Route::group('serverRunningStatus',function (){
            Route::rule('get', 'adminapiv3/platform_manage.Config/getServerRunningStatus');//配置获取
        });
    });

    //平台管理
    Route::group('platform',function (){
        //平台管理->信任主机
        Route::group('allowip',function (){
            Route::rule('list', 'adminapiv3/platform_manage.ServerAllowIp/list');
            Route::rule('add', 'adminapiv3/platform_manage.ServerAllowIp/add');
            Route::rule('modify', 'adminapiv3/platform_manage.ServerAllowIp/modify');
            Route::rule('del', 'adminapiv3/platform_manage.ServerAllowIp/del');
        });

        //中间件管理
        Route::group('middleware',function (){
            //代理管理
            //Route::rule('list', 'adminapiv3/platform_manage.ServerMiddleware/proxyList');
            //日志管理
            //Route::rule('syncLog/list','adminapiv3/platform_manage.ServerMiddleware/syncLogList');
            //模块管理
            Route::rule('module/list','adminapiv3/platform_manage.ServerMiddleware/moduleList');
        });

        //平台管理->授权管理
        Route::group('auth',function (){
            Route::rule('list', 'adminapiv3/platform_manage.ServerAuth/list');//授权列表
            Route::rule('online', 'adminapiv3/platform_manage.ServerAuth/online');//---在线授权
            Route::rule('gethostfile', 'adminapiv3/platform_manage.ServerAuth/getHostFile');//---获取主机码文件
            Route::rule('offline', 'adminapiv3/platform_manage.ServerAuth/offline');//---离线授权
        });

        //平台管理->资产组
        Route::group('hostGroup',function (){
            Route::get('index', 'adminapiv3/platform_manage.ServerHostGroup/index');//资产组列表
            Route::rule('add', 'adminapiv3/platform_manage.ServerHostGroup/add');//添加资产组
            Route::rule('modify', 'adminapiv3/platform_manage.ServerHostGroup/modify');//修改资产组
            Route::post('del', 'adminapiv3/platform_manage.ServerHostGroup/del');//删除资产组
        });

        //平台管理->账号管理
        Route::group('account',function (){
            //平台管理->账号管理->用户管理
            Route::group('user',function (){
                Route::get('list', 'adminapiv3/platform_manage.account.ServerUser/list');//用户管理
                Route::rule('add', 'adminapiv3/platform_manage.account.ServerUser/add');//用户添加
                Route::rule('modify', 'adminapiv3/platform_manage.account.ServerUser/modify');//修改用户数据
                Route::rule('del', 'adminapiv3/platform_manage.account.ServerUser/del');//删除用户数据
                Route::rule('modifyuserpassword', 'adminapiv3/platform_manage.account.ServerUser/modifyUserPassword');//修改当前登录用户密码
                Route::post('resetPassword', 'adminapiv3/platform_manage.account.ServerUser/resetPassword');//管理员重置登录密码
            });

            //平台管理->账号管理->权限管理 此接口不对接前端 也不入权限表中
            Route::group('permission',function (){
                Route::get('list', 'adminapiv3/platform_manage.account.ServerPermission/index');//权限列表
                Route::rule('add', 'adminapiv3/platform_manage.account.ServerPermission/add');//添加权限
                Route::rule('modify', 'adminapiv3/platform_manage.account.ServerPermission/modify');//修改权限
                Route::post('del', 'adminapiv3/platform_manage.account.ServerPermission/del');//删除权限
            });

            //平台管理->账号管理->角色管理
            Route::group('group',function (){
                Route::get('list', 'adminapiv3/platform_manage.account.ServerUserGroup/index');//角色列表
                Route::post('add', 'adminapiv3/platform_manage.account.ServerUserGroup/add');//添加角色
                Route::post('modify', 'adminapiv3/platform_manage.account.ServerUserGroup/modify');//修改角色
                Route::post('del', 'adminapiv3/platform_manage.account.ServerUserGroup/del');//删除角色
                Route::rule('auth', 'adminapiv3/platform_manage.account.ServerUserGroup/auth');//角色授权
            });

        });

        //数据库
        Route::group('databases',function (){
            Route::get('list', 'adminapiv3/platform_manage.ServerDatabases/index');//数据库列表
        });

        //平台管理->平台日志
        Route::group('log',function (){
            //平台管理->平台日志->操作日志
            Route::group('history',function (){
                Route::rule('list', 'adminapiv3/platform_manage.log.ServerOptionHistory/list'); //操作日志
                Route::rule('detail', 'adminapiv3/platform_manage.log.ServerOptionHistory/detail'); //操作日志详情
            });

            //平台管理->平台日志->更新日志
            Route::group('updatelog',function (){
                Route::rule('hostUpdateList', 'adminapiv3/platform_manage.log.ServerUpdateLog/hostUpdateList');//主机系统更新日志
                Route::rule('list', 'adminapiv3/platform_manage.log.ServerUpdateLog/list');//系统更新日志 - 详情
            });

            //平台管理->平台日志客户端日志
//            Route::group('clientlog',function (){
//                Route::rule('list', 'adminapiv3/platform_manage.log.LogClientOperation/list'); //列表
//            });

            //平台管理->平台日志->通信日志
            Route::group('cmdslog',function (){
                Route::rule('list', 'adminapiv3/platform_manage.log.CmdsHistory/list');//下发命令历史 --平台管理/平台日志/通信日志
            });

            //平台管理->平台日志->客户端错误日志
            Route::group('clienterrorlog',function (){
                Route::rule('list', 'adminapiv3/platform_manage.log.ClientErrorLog/list');//客户端错误日志 --平台管理/平台日志/客户端错误日志
            });
        });

        //平台管理->产品更新
        Route::group('update',function (){
            Route::rule('offline', 'adminapiv3/platform_manage.ServerUpdate/offline');//产品更新
            Route::rule('upgrade', 'adminapiv3/platform_manage.ServerUpdate/upgrade');//产品升级
        });

    });

    /**************************************************************平台管理 END ******************************************************/

//下载管理
    //模块 1=>Netfilter日志 2=>规则 3=>主机码文件下载 4=>linux安装包下载 5=>windows安装包下载 6=>linux更新包 7windows更新包 8网络攻击数据包
    Route::rule('download/list/:module', 'adminapiv3/ServerDownload/list');
    Route::rule('download/del/:module', 'adminapiv3/ServerDownload/del');
    Route::rule('download/create/:module', 'adminapiv3/ServerDownload/create');


    //出口设置
    Route::rule('proxy/get', 'adminapiv3/platform_manage.ServerProxy/get');//设置代理服务器IP
    Route::rule('proxy/modify', 'adminapiv3/platform_manage.ServerProxy/modify');//设置代理服务器IP

});
